﻿angular.module('Caltech').directive('quarterlyReport', function () {
    'use strict';
    
    var controller = function ($scope, Restangular) {

        $scope.yearInput = (new Date).getFullYear();
        $scope.currentQuarterlyReportDate = new Date;

        $scope.quarterlyothers = {
            other1: "Other 1",
            other2: "Other 2",
            other3: "Other 3",
            other4: "Other 4",
            other5: "Other 5"
        };

        $scope.getQuarterlyReport = function () {
            Restangular.all('reports').customGETLIST(
            'quarterlyReport',
            {
                year: $scope.yearInput
            }).then(function (reports) {
                $scope.quarterlyReport = reports;
            });
        };

        $scope.getQuarterlyReport();
    };

    return { 
        restrict: 'E',
        replace: true,
        transclude: true,
        templateUrl: 'Scripts/app/views/_partials/quarterlyReport.html',
        controller: controller
    }
});
